package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsMobileEventCountReadDao;
import com.party.core.dao.write.analysis.StatisticsMobileEventCountWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsMobileEventCounter;
import com.party.core.service.analysis.IStatisticsMobileEventCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 手机端统计事件流程接口实现
 * @author: yuguangqing
 * @create: 2018-09-11 14:47
 **/

@Service
public class StatisticsMobileEventCountService implements
        IStatisticsMobileEventCountService {

    @Autowired
    private StatisticsMobileEventCountWriteDao statisticsMobileEventCountWriteDao;
    @Autowired
    private StatisticsMobileEventCountReadDao statisticsMobileEventCountReadDao;


//    @Override
//    public boolean batchInsert(List<StatisticsMobileEventCounter> eventCounterList) {
//        eventCounterList.stream().forEach(eventCounter -> BaseModel.preInsert(eventCounter));
//        return statisticsMobileEventCountWriteDao.batchInsert(eventCounterList);
//    }

    @Override
    public List<StatisticsMobileEventCounter> listPageByOthers(StatisticsMobileEventCounter eventCounter,
                                                               Map<String, Object> params, Page page) {
        return statisticsMobileEventCountReadDao.listPageByOthers(eventCounter, params, page);
    }

    @Override
    public List<StatisticsMobileEventCounter> mobileCountList(Map<String, Object> map) {
        return statisticsMobileEventCountReadDao.mobileCountList(map);
    }

    @Override
    public String insert(StatisticsMobileEventCounter eventCounter) {
        BaseModel.preInsert(eventCounter);
        return statisticsMobileEventCountWriteDao.insert(eventCounter) ? eventCounter.getId() : null;
    }

    @Override
    public boolean update(StatisticsMobileEventCounter eventCounter) {
        return eventCounter == null ? null : statisticsMobileEventCountWriteDao.update(eventCounter);
    }

    @Override
    public boolean deleteLogic(String id) {
        return id == null ? false : statisticsMobileEventCountWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(String id) {
        return id == null ? false : statisticsMobileEventCountWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return ids == null || ids.isEmpty() ? false : statisticsMobileEventCountWriteDao.batchDeleteLogic(ids);
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return ids == null || ids.isEmpty() ? false : statisticsMobileEventCountWriteDao.batchDelete(ids);
    }

    @Override
    public StatisticsMobileEventCounter get(String id) {
        return id == null || id.isEmpty() ? null : statisticsMobileEventCountReadDao.get(id);
    }

    @Override
    public List<StatisticsMobileEventCounter> listPage(StatisticsMobileEventCounter eventCounter, Page page) {
        return null;
    }

    @Override
    public List<StatisticsMobileEventCounter> list(StatisticsMobileEventCounter eventCounter) {
        return null;
    }

    @Override
    public List<StatisticsMobileEventCounter> batchList(Set<String> ids, StatisticsMobileEventCounter eventCounter, Page page) {
        return null;
    }
}
